Skip to content

Conversation

@MLabs-code
Copy link

No description provided.

@MLabs-code MLabs-code requested a review from adamayoung as a code owner May 4, 2025 13:12
@adamayoung adamayoung requested a review from Copilot December 2, 2025 10:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds missing endpoints for TV shows and introduces a new Find service for searching TMDb content using external IDs (IMDB, Facebook, etc.). The changes include three new TV series list endpoints (top rated, on the air, airing today), a refactored season model to support basic season information, and comprehensive Find service infrastructure.

Key changes:

  • Added three new TV series list endpoints: topRated, onTheAir, and airingToday
  • Introduced FindService with support for external ID lookups across multiple platforms
  • Refactored TVSeries model to use TVSeasonBasic instead of TVSeason for better separation of concerns

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
Tests/TMDbTests/TestUtils/Tags.swift Added test tag for find service
Tests/TMDbTests/Domain/Services/Find/TMDbFindServiceTest.swift Basic test setup for find service
Sources/TMDb/TMDBClient.swift Integrated FindService into main client
Sources/TMDb/Networking/TMDbAPIClient.swift Added debug logging for API responses
Sources/TMDb/Domain/Services/TVSeries/TVSeriesService.swift Added protocol methods for three new TV series endpoints
Sources/TMDb/Domain/Services/TVSeries/TMDbTVSeriesService.swift Implemented three new TV series list methods
Sources/TMDb/Domain/Services/TVSeries/Requests/TopRatedTVSeriesRequest.swift Request implementation for top rated TV series
Sources/TMDb/Domain/Services/TVSeries/Requests/OnTheAirTVSeriesRequest.swift Request implementation for on the air TV series
Sources/TMDb/Domain/Services/TVSeries/Requests/AiringTodayTVSeriesRequest.swift Request implementation for airing today TV series
Sources/TMDb/Domain/Services/Find/TMDbFindService.swift Core find service implementation
Sources/TMDb/Domain/Services/Find/Request/FindRequest.swift API request for find by external ID
Sources/TMDb/Domain/Services/Find/FindService.swift Protocol definition for find service
Sources/TMDb/Domain/Models/TVSeries.swift Changed seasons property to use TVSeasonBasic
Sources/TMDb/Domain/Models/TVSeasonBasic.swift New basic season model without episode details
Sources/TMDb/Domain/Models/FindServiceType.swift Enum of supported external ID sources
Sources/TMDb/Domain/Models/FindResponse.swift Response models for find API results
Sources/TMDb/Domain/APIClient/APIRequestQueryItem.swift Added external_source query parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

final class AiringTodayTVSeriesRequest: DecodableAPIRequest<TVSeriesPageableList> {

init(page: Int? = nil, language: String? = nil) {
let path = "/tv/popular"
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The API path is incorrect for airing today endpoint. It should be '/tv/airing_today' instead of '/tv/popular'.

Suggested change
let path = "/tv/popular"
let path = "/tv/airing_today"

Copilot uses AI. Check for mistakes.
Comment on lines 62 to +63
do {
debugPrint("Data \(String(describing: String(data: data, encoding: .utf8)))")
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug print statement should be removed before merging to production. Consider using a proper logging framework or conditional compilation for debug builds.

Suggested change
do {
debugPrint("Data \(String(describing: String(data: data, encoding: .utf8)))")
do {
#if DEBUG
debugPrint("Data \(String(describing: String(data: data, encoding: .utf8)))")
#endif

Copilot uses AI. Check for mistakes.
}

@Test("find by external id")
func movieGenresWithDefaultParameterValuesReturnsGenres() async throws {
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test function name 'movieGenresWithDefaultParameterValuesReturnsGenres' doesn't match the test purpose which is to test finding by external ID.

Suggested change
func movieGenresWithDefaultParameterValuesReturnsGenres() async throws {
func findByExternalIdReturnsExpectedResult() async throws {

Copilot uses AI. Check for mistakes.
let result = try await (service as FindService).findId("tt11952708",
type: .imdbID)

print(result)
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test should include assertions instead of just printing the result. Add proper validation to verify the expected behavior.

Suggested change
print(result)
// Validate the result is not nil and matches expected structure
#expect(result != nil, "Result should not be nil")
// Optionally, add more specific assertions if you know the expected result
// For example, if result is a FindResult type:
// #expect(result.movies.count > 0, "Should find at least one movie")

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +30
/// https://api.themoviedb.org/3/find/tt11952708?external_source=imdb_id'
///

Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment contains an example URL but lacks context. Either remove this or properly document it as an example with explanation of the API endpoint.

Suggested change
/// https://api.themoviedb.org/3/find/tt11952708?external_source=imdb_id'
///
/// Example API endpoint:
/// https://api.themoviedb.org/3/find/tt11952708?external_source=imdb_id
///
/// This endpoint allows you to search for content on TMDb using an external ID.
/// - `tt11952708` is an example external ID (in this case, an IMDb ID).
/// - `external_source=imdb_id` specifies the type of external ID being used.
/// The `findId(_:type:)` function wraps this endpoint, allowing you to search for TMDb content by providing an external ID and its type.

Copilot uses AI. Check for mistakes.
let overview: String
let posterPath: String?

// Pre filmy
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment appears to be in a non-English language. Should be 'For movies' instead of 'Pre filmy'.

Suggested change
// Pre filmy
// For movies

Copilot uses AI. Check for mistakes.
let releaseDate: String?
let video: Bool?

// Pre seriály
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment appears to be in a non-English language. Should be 'For TV series' instead of 'Pre seriály'.

Suggested change
// Pre seriály
// For TV series

Copilot uses AI. Check for mistakes.
Comment on lines +209 to +212
/// TODO:

enum CodingKeys: String, CodingKey {
case id
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete TODO comment. The TVSeasonResult struct is not fully implemented - either complete the implementation or add a descriptive TODO explaining what needs to be done.

Suggested change
/// TODO:
enum CodingKeys: String, CodingKey {
case id
let airDate: String?
let episodeCount: Int?
let name: String?
let overview: String?
let posterPath: String?
let seasonNumber: Int?
let showId: Int?
let voteAverage: Double?
enum CodingKeys: String, CodingKey {
case id
case airDate = "air_date"
case episodeCount = "episode_count"
case name
case overview
case posterPath = "poster_path"
case seasonNumber = "season_number"
case showId = "show_id"
case voteAverage = "vote_average"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant